package com.bree.erp.jsf.vo;

import com.bree.erp.entity.CrudId;
import com.bree.erp.entity.Inventory;
import com.bree.erp.entity.Unit;

public class InventoryDT implements CrudId<String> {

	private String id;
	private Inventory inventory;
	private String name;
	private String description;
	private Unit unit;
	private Double quantity;
	private Double threashold;
	
	
	public InventoryDT(String id, Inventory inventory, Unit unit,
			Double quantity, Double threashold) {
		super();
		this.id = id;
		this.inventory = inventory;
		this.unit = unit;
		this.quantity = quantity;
		this.threashold = threashold;
		
		this.name = inventory.getMasterItem().getName();
		this.description = inventory.getMasterItem().getDescription();
	}
	
	public InventoryDT(String id) {
		this.id = id;
	}

	@Override
	public boolean equals(Object obj) {
		
		if(obj instanceof InventoryDT) {
			InventoryDT that = (InventoryDT) obj;
			return this.id.equals(that.id);
		}
		
		return false;
	}
	
	@Override
	public int hashCode() {
		return this.id == null ? 0 : this.id.hashCode();
	}
	
	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}
	/**
	 * @return the inventory
	 */
	public Inventory getInventory() {
		return inventory;
	}
	/**
	 * @param inventory the inventory to set
	 */
	public void setInventory(Inventory inventory) {
		this.inventory = inventory;
	}
	/**
	 * @return the unit
	 */
	public Unit getUnit() {
		return unit;
	}
	/**
	 * @param unit the unit to set
	 */
	public void setUnit(Unit unit) {
		this.unit = unit;
	}
	/**
	 * @return the quantity
	 */
	public Double getQuantity() {
		return quantity;
	}
	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(Double quantity) {
		this.quantity = quantity;
	}
	/**
	 * @return the threashold
	 */
	public Double getThreashold() {
		return threashold;
	}
	/**
	 * @param threashold the threashold to set
	 */
	public void setThreashold(Double threashold) {
		this.threashold = threashold;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
}
